//测试地址
//const baseUrl = 'http://192.168.31.74:8080/'
//正式地址
const baseUrl = 'http://112.126.76.23/prod-api/'


const http = (url = '', date = {}, type = 'POST', header = {
}) => {
    return new Promise((resolve, reject) => {
		header={};
		
		header['Content-Type']='application/json;charset=utf-8';
        uni.request({
            method: type,
            url: baseUrl + url,
            data: date,
            header: header,
            dataType: 'json',         
        }).then((response) => {
           // console.log(response)
            //let [error, res] = response;
		    //console.log(res)
			/* if(res.data.code==401||res.data.code==403){
			
				 uni.clearStorageSync()
				
			}else if(res.data.code==409){
				 // getToken(url,date,type,header)
			} */
            resolve(response.data);
        }).catch(error => {
            let [err, res] = error;
            reject(err)
        }) 
    });
}


export default {
	http
}